package com.example.stumanager.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.stumanager.R;
import com.example.stumanager.entity.HolidayDestinationEntity;

import java.util.ArrayList;

/**
 * 假期去向适配器
 */
public class HolidayDestinationAdapter extends ArrayAdapter<HolidayDestinationEntity> {
    public HolidayDestinationAdapter(@NonNull Context context, int resource, @NonNull ArrayList objects) {
        super(context, resource, objects);
    }
    //每个子项被滚动到屏幕内的时候会被调用
    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        HolidayDestinationEntity w=getItem(position);

        View view= LayoutInflater.from(getContext()).inflate(R.layout.layout_jiaqi,parent,false);

        TextView name =view.findViewById(R.id.name);
        TextView tel =view.findViewById(R.id.tel);
        TextView address=view.findViewById(R.id.address);

        name.setText("姓名："+w.getName());
        tel.setText("电话："+w.getTel());
        address.setText("假期去向："+w.getAddress());
        return view;
    }

}
